<?php



require_once(sfConfig::get('sf_app_lib_dir').'/common/html/tags/HTMLTag.php');

require_once(sfConfig::get('sf_app_lib_dir').'/common/html/tags/header/HeadTag.php');
require_once(sfConfig::get('sf_app_lib_dir').'/common/html/tags/header/MetaDataTag.php');
require_once(sfConfig::get('sf_app_lib_dir').'/common/html/tags/header/StylesTag.php');
require_once(sfConfig::get('sf_app_lib_dir').'/common/html/tags/header/ScriptTag.php');
require_once(sfConfig::get('sf_app_lib_dir').'/common/html/tags/header/FavIconTag.php');

require_once(sfConfig::get('sf_app_lib_dir').'/common/html/tags/body/BodyTag.php');


/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ManagerHTML
 *
 * @author jhonny
 */
class ManagerHTML {
    private $html;
    public function __construct() {
        
        $this->html=new HTMLTag();
        $this->html->setHeader(new HeadTag());
        $this->html->setBody(new BodyTag());
    }
    public  function getHTML() {
        return $this->html;
    }
    public  function setHTML(HTMLTag $html) {
        return $this->html=$html;
    }
    public function toString() {
        $strValue='';
//        $strValue.='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
//        $strValue.='<HTML xmlns="http://www.w3.org/1999/xhtml">';
//        $strValue.=$this->getHTML()->getStrHeader();
        $strValue.=$this->getHTML()->getStrBody();
//        $strValue.='</HTML>';
        return $strValue;
    }

    ////////HEADER//////////////////////
    /**
     *
     * @return <src/html/tags/header/HeadTag>
     */
    private function getHeader(){
        return $this->getHTML()->getHeader();
    }
    protected  function setTitle($title) {
        $this->getHeader()->setTitle($title);
    }
    protected  function setMetaDataCharset($charSet) {
        $metaDataCharset = new MetaDataTag();
        $metaDataCharset->setContent($charSet);
        $this->getHeader()->addLink($metaDataCharset);
    }
    protected  function setDefaultMetaDataCharset() {
        $value = new MetaDataTag();
        $this->getHeader()->addLink($value);
    }
    protected  function setFavIcon($value) {
        $tag = new FavIconTag();
        $tag->setHref($value);
        $this->getHeader()->addLink($tag);
    }

    protected  function addStyleTag($style) {
        $tag = new StylesTag();
        $tag->setHref($style);
        $this->getHeader()->addLink($tag);
    }
    protected  function addScriptTag($value) {
        $tag = new ScriptTag();
        $tag->setSrc($value);
        $this->getHeader()->addLink($tag);
    }
    ///////////////BODY////////////////
    /**
     *
     * @return <../tags/body/BodyTag.php>
     */
    private function getBody(){
        return $this->html->getBody();
    }
    protected  function setBodyHeader($value) {
        $this->getBody()->setHeader($value);
    }
    protected  function setBodyCenter($value) {
        $this->getBody()->setCenter($value);
    }
    protected  function setBodyFooter($value) {
        $this->getBody()->setFooter($value);
    }
}
?>
